package com.crazy.crazyserviceclient.service;

import com.crazy.crazycommon.common.BaseResponse;
import com.crazy.crazymodel.model.dto.product.ProductAddRequest;
import com.crazy.crazymodel.model.dto.product.ProductGetRequest;
import com.crazy.crazymodel.model.dto.product.ProductNetWorthRequest;
import com.crazy.crazymodel.model.dto.product.ProductUpdateRequest;
import com.crazy.crazymodel.model.entity.Customer;
import com.crazy.crazymodel.model.entity.Product;
import com.crazy.crazymodel.model.vo.ProductAddVO;
import com.crazy.crazymodel.model.vo.ProductGetVO;
import com.crazy.crazymodel.model.vo.ProductNetWorthVO;
import com.crazy.crazymodel.model.vo.ProductUpdateVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;

/**
 * @Date: 2024-05-06-20:37
 * @Author: Zheng Zeliang
 */
@FeignClient(name = "crazy-product-service", path = "/api/product/inner")
public interface ProductFeignClient {

    /**
     * 根据 id 获取产品
     * @param productID
     * @return
     */
    @GetMapping("/get/id")
    Product getById(@RequestParam("productID") int productID);

    /**
     * 根据 id 获取产品列表
     * @param idList
     * @return
     */
    @GetMapping("/get/ids")
    List<Product> listByIds(@RequestParam("idList") Collection<Integer> idList);

    /**
     * 获取产品列表
     * @param productGetRequest 接收管理员查询请求的数据对象
     * @return productGetVO
     */
    @GetMapping("/get")
    BaseResponse<ProductGetVO> productGet(@RequestBody ProductGetRequest productGetRequest);

    /**
     * 新增产品
     * @param productAddRequest 接收管理员查询请求的数据对象
     * @return productAddVO
     */
    @PostMapping("/add")
    BaseResponse<ProductAddVO> productGet(@RequestBody ProductAddRequest productAddRequest);

    /**
     * 修改产品信息
     * @param productUpdateRequest 接收管理员查询请求的数据对象
     * @return productUpdateVO
     */
    @PostMapping("/update")
    public BaseResponse<ProductUpdateVO> productGet(@RequestBody ProductUpdateRequest productUpdateRequest);

    /**
     * 获取产品净值走势
     * @param productNetWorthRequest 接收管理员查询请求的数据对象
     * @return productNetWorthVO
     */
    @PostMapping("/getValue")
    public BaseResponse<ProductNetWorthVO> productGetValue(@RequestBody ProductNetWorthRequest productNetWorthRequest);

    /**
     * 根据产品代码获取产品
     * @param productCode
     * @return
     */
    @GetMapping("/get/code")
    Product getByCode(@RequestParam("productCode") String productCode);

}
